import MySQLdb

conn = MySQLdb.connect(host='47.104.31.138', port=3306,
                       user='hellokitty', password='Hellokitty.618',
                       database='python2005', charset='utf8mb4')
try:
    with conn.cursor() as cursor:
        index = 0
        for _ in range(100):
            params = []
            for _ in range(1000):
                index += 1
                params.append((f'user{index}', '00000'))
            cursor.executemany(
                'insert into tb_test1 (username, password) values (%s, %s)',
                params
            )
    conn.commit()
except MySQLdb.MySQLError as err:
    print(err)
    conn.rollback()
finally:
    conn.close()
